<template>
  <div class="search">
    <!-- 搜索框 -->
    <form action="/">
      <van-search
        v-model="value"
        placeholder="请输入搜索内容"
        show-action
        shape="round"
        @search="onSearch"
        @cancel="onCancel"
      />
    </form>
    <!-- 搜索结果 -->
    <div class="search-result m-t-10">
      <div class="histroy">
        <div class="label">
          搜索历史
          <van-icon name="delete" class="fr" />
        </div>
        <ul class="search-list">
          <li>阳澄湖水上公园游乐场</li>
          <li>沈万三故居</li>
          <li>动物奇幻世界</li>
        </ul>
      </div>
      <div class="hot-search">
        <div class="label">热门搜索</div>
        <ul class="search-list">
          <li>阳澄湖水上公园游乐场</li>
          <li>沈万三故居</li>
          <li>动物奇幻世界</li>
          <li>沈万三故居</li>
          <li>动物奇幻世界</li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: ""
    };
  },
  methods: {
    //搜索
    onSearch() {
      console.log(arguments);
    },
    //取消输入
    onCancel() {
      console.log(arguments);
    }
  }
};
</script>

<style lang="scss" scoped>
.search {
  .search-result {
    margin: 0 15px;
    .label {
      font-size: 15px;
      font-weight: 800;
      margin: 3px 0 14px;
    }
    // 搜索列表
    .search-list {
      display: flex;
      flex-wrap: wrap;
      li {
        margin: 0 5px 10px 0;
        padding: 0 9px;
        border-radius: 12px;
        line-height: 24px;
        font-size: 12px;
        color: #464646;
        background: rgb(236, 236, 236);
        &:last-child {
          margin-right: 0;
        }
      }
    }
  }
}
</style>